package com.cy.store.Controller;


import com.cy.store.Entity.Address;
import com.cy.store.Entity.District;
import com.cy.store.Service.Ex.AddressCountLimitException;
import com.cy.store.Service.Ex.InsertException;
import com.cy.store.Service.IAddressService;
import com.cy.store.Service.IDistrictService;
import com.cy.store.util.JsonResult;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
@RestController
@RequestMapping("/districts")
public class DistrictController extends BaseController{
    @Autowired
    private IDistrictService iDistrictService;

    @RequestMapping("/get_districts_byParent")
    public JsonResult<List<District>> getDistrictsByParent(String parent){
        List<District> list = iDistrictService.getDistrictsByParent(parent);
        return new JsonResult<>(OK,list);
    }

}
